import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
import { SServerKey } from "./SServerKey";
//class SeqServerKeyHelper

export class SeqServerKeyHelper {
  public static write(arg1: SerializeStream, arg2: Array<SServerKey>): void {
    var loc1 = 0;
    var loc2 = null;
    if (arg2 != null) {
      arg1.writeSize(arg2.length);
      loc1 = 0;
      while (loc1 < arg2.length) {
        arg2[loc1].__write(arg1);
        ++loc1;
      }
    } else {
      arg1.writeSize(0);
    }
    return;
  }

  public static read(arg1: SerializeStream) {
    var loc4 = null;
    var loc2 = arg1.readSize();
    arg1.checkFixedSeq(loc2, 8);
    var loc1 = new Array<SServerKey>();
    var loc3 = 0;
    while (loc3 < loc2) {
      (loc4 = new SServerKey()).__read(arg1);
      loc1[loc3] = loc4;
      ++loc3;
    }
    return loc1;
  }
}
